<?php
defined('IN_IA') or exit('Access Denied');

global $_W, $_GPC;
$op = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
//咨询列表页
if ($op == 'display') {

    $pindex = max(1, intval($_GPC['page']));
    $psize = 10;
    $uniacid=$_W['uniacid'];
    $condition = " uniacid = '{$uniacid}'";
    $total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('aide_cooper') . " WHERE $condition");
    $cooper=pdo_fetchall("SELECT * FROM " . tablename('aide_cooper') . " WHERE uniacid=$uniacid ORDER BY id ASC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
    //记录总数
    $pager = pagination($total, $pindex, $psize);
    include aide_template ('cooper');
    exit;
}
if ($op == 'delete') {
    $cooperid = intval($_GPC['cooperid']);
    pdo_delete ('aide_cooper', array ('id' => $cooperid));
    die(json_encode(array("errno" => 0,'message'=>'删除成功')));
    exit;
}
